<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<form id="priceConfigForm" action="priceConfig.do?savePriceConfig">
			<table cellpadding="5">
				<input name="id" type="hidden" value="${(priceConfigItem.id)!}" />
				<tr>
					<td class="tbLabel">首重(公斤):</td>
					<td>
						<input name="firstWeight" style="width:158px;" class="easyui-numberbox"  precision="0" data-options="required: true" value="${(priceConfigItem.firstWeight)!}"/>
					</td>
					<td class="tbLabel">首重价格(元):</td>
					<td>
						<input name="firstPrice" style="width:158px;" class="easyui-numberbox"  precision="2" data-options="required: false" value="${(priceConfigItem.firstPrice)!}"/>
					</td>
					<td width="90px">续重(公斤):</td>
					<td>
						<input name="addWeight" style="width:158px;" class="easyui-numberbox"  precision="0" data-options="required: false" value="${(priceConfigItem. addWeight)!}"/>
					</td>
					<td class="tbLabel">续重价格(元):</td>
					<td>
						<input name="addPrice" style="width:158px;" class="easyui-numberbox"  precision="2" data-options="required: false" value="${(priceConfigItem.addPrice)!}"/>
					</td>
				</tr>
				<tr>
					<td colspan="8">
					 <div class="easyui-panel" data-options="border: false" title="价格分配规则">
					 </div>
					</td>
				</tr>
				<tr>
					<td class="tbLabel">中转网点:</td>
					<td>						
						<@eu.comboBox url="transWebSite.do?loadWebsiteCombox&value=${(priceConfigItem.linkWebsiteId)!}" name="linkWebsiteId" onSelect="selectPriceConfigWebsite(value)"/>
					</td>
					<td class="tbLabel">中转账户:</td>
					<td>
						<@eu.comboBox id="priceConfigAccount" url="transAccount.do?loadAccountCombox&value=${(priceConfigItem.linkWebsiteAccountid)!}&websiteId=${(priceConfigItem.linkWebsiteId)!}" name="linkWebsiteAccountid"  />
					</td>
					<td class="tbLabel">是否目的站派件:</td>
					<td>
						<@eu.comboBox name="isTargetDEliver" url="common.do?loadComboBox&key=YON&value=${(priceConfigItem.isTargetDEliver)!'false'}" />
					</td>
				</tr>
				<tr>
					<td class="tbLabel">中转(元):</td>
					<td>
						<input name="linkPrice" style="width:158px;" class="easyui-numberbox"  precision="2" data-options="required: false" value="${(priceConfigItem.linkPrice)!}"/>
					</td>
					<td class="tbLabel">派件(元):</td>
					<td>
						<input name="deliveryPrice" style="width:158px;" class="easyui-numberbox"  precision="2" data-options="required: false" value="${(priceConfigItem.deliveryPrice)!}"/>
					</td>
					<td class="tbLabel">续重派件(元):</td>
					<td>
						<input name="addDeliveryPrice" style="width:158px;" class="easyui-numberbox"  precision="2" data-options="required: false" value="${(priceConfigItem.addDeliveryPrice)!}"/>
					</td>
					<td>按公斤计算</td>
				</tr>
			</table>
		</form>
	</div>
	<div data-options="region:'south',border:false">
		<div style="padding:3px 0;border-top:1px solid #95B8E7;text-align: center;">		
			<@eu.linkbutton showName="更新或保存" shiro="trans:priceConfig:save" iconCls="icon-edit" style="border:1px solid #bbb;background: #eaf2ff;" onclick="saveOrUpdatePriceConfig()"/>
	    </div>
	</div>
</div>
<script type="text/javascript">
function saveOrUpdatePriceConfig() {
	var validate = $('#priceConfigForm').form("validate");
	if(validate) {
		var actionurl = $('#priceConfigForm').attr('action');//提交路径
		var formData = new Object();

		var fields = $('#priceConfigForm').serializeArray(); //自动序列化表单元素为JSON对象  

		$.each(fields, function(i, field) {
			printLog(field.name + "=" + field.value);
			formData[field.name] = field.value;
		});
		printLog(formData);
		$.ajax({
			async : false,
			cache : false,
			type : 'POST',
			url : actionurl,// 请求的action路径
			data : formData,
			error : function() {// 请求失败处理函数
				showMsg('保存失败.');
			},
			success : function(data) {
				showMsg('保存成功.');
			}
		});
	}
	
}

function selectPriceConfigWebsite(value) {
	$('#priceConfigAccount').combobox("clear").combobox('reload','transAccount.do?loadAccountCombox&websiteId='+value.value);
}
</script>

